package com.ycz.pattern.structure.adapterpattern;

/**
 * @Description
 * @ClassName AudioPlayer
 * @Author yanchengzhi
 * @date 2023.11.22 01:15
 */
public class AudioPlayer implements MediaPlayer {

    MediaAdapter mediaAdapter;

    @Override
    public void play(String type, String fileName) {
        if("mp3".equalsIgnoreCase(type)) {
            System.out.println("播放mp3文件：" + fileName);
        } else if("vlc".equalsIgnoreCase(type) || "mp4".equalsIgnoreCase(type)) {
            mediaAdapter = new MediaAdapter(type);
            mediaAdapter.play(type,fileName);
        } else {
            System.out.println("不支持此种格式！" + type);
        }
    }
}
